<template>
  <div class="newsinfo-container">
    <!--{{ $route.params.id}}-->
    <p class="news-title">{{goodsInfo.title}}</p>
    <hr>
    <div class="content" v-html="goodsInfo.content"></div>
  </div>
</template>

<script>
import { Toast } from "mint-ui";
export default {
  data() {
    return {
      id: this.$route.params.id,
      goodsInfo: {}
    };
  },
  created() {
    this.getgoodsInfo();
  },
  methods: {
    getgoodsInfo() {
      this.$http.get("goodsInfo#!method=get").then(result => {
        if (result.status === 200) {
          this.goodsInfo = result.body.message[0];
        } else {
          Toast("商品详情获取失败");
        }
      });
    }
  }
};
</script>

<!--为了让内容里的图片能够是100%  要把 scoped 去了-->
<style lang="scss">
.newsinfo-container {
  padding: 10px 5px 0;
  .news-title {
    font-size: 14px;
    line-height: 30px;
    color: #333;
    text-align: center;
    margin: 0 auto;
  }
  .sub-title {
    font-size: 12px;
    line-height: 24px;
    color: #ddd;
    margin: 0 auto;
  }
  .content {
    font-size: 12px;
    line-height: 24px;
    img {
      max-width: 100%;
    }
  }
}
</style>